<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ name }}</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap--dist/css/bootstrap.min.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='datatables.bootstrap.min.css') }}">
    <script type="text/javascript" src="{{ url_for('static', filename='jquery-3.5.0.min.js') }}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#example').DataTable();
        });
    </script>
</head>
<body>

<div class="container">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a href="/index/" class="navbar-brand active " style="color: #a721e2;font-size:14px">TheOne新闻社</a>
            </div>
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="/index/">首页</a></li>
                    <li><a href="{{ url_for('category',name='推荐') }}">推荐</a></li>
                    <li><a href="{{ url_for('category',name='时政新闻') }}">时政新闻</a></li>
                    <li><a href="{{ url_for('category',name='娱乐') }}">娱乐</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <form class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="要不搜搜看......">
                        </div>
                        <button type="submit" class="btn btn-default">搜索</button>
                    </form>
{#                    <li class="dropdown">#}
{#                        <a href="{{ url_for('admin') }}" class="dropdown-toggle" data-toggle="dropdown" role="button"#}
{#                           aria-haspopup="true"#}
{#                           aria-expanded="false">发布</a>#}
{#                    </li>#}
                </ul>
            </div>
        </div>
    </nav>
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="background-color:#eeeeee;">
        {% for obj in news_list %}
            <div class="media" style="margin-top: 5px;">

                <div class="media-left">

                    <a href="{{ url_for('detail', pk=obj.id) }}">
                        <img class="media-object" src="{{ obj.image }}" alt="图片">
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                        <a href="{{ url_for('detail', pk=obj.id) }}">
                            {{ obj.title }}
                        </a>
                    </h4>
                    <div>{{ obj.content }}</div>
                    <div>
                    <span>作者：
                        {{ obj.author }}
                    </span>
                        <span>
                        浏览量：
                            {{ obj.view_count }}</span>
                        <span>发布时间：
                            {{ obj.created_at }}</span>
                    </div>
                </div>
                <hr/>
            </div>
        {% endfor %}

    </div>

    <script type="text/javascript" src="{{ url_for('static', filename = 'datatables.bootstrap.min.js') }}"></script>
</body>
</html>

